From: Sam Steingold Date: Wed, 21 Mar 2012 16:01:18 +0000 (-0400) Subject: * lisp/window.el (switch-to-prev-buffer): Do not switch to a visible X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~324^2~406 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=c68134baf675390e84f73af266bcf400b9d0e14d;p=emacs.git * lisp/window.el (switch-to-prev-buffer): Do not switch to a visible window previous buffer, just like with the frame previous buffers. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index db6b919d30d..510f08fd20f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-03-21 Sam Steingold + + * window.el (switch-to-prev-buffer): Do not switch to a visible + window previous buffer, just like with the frame previous buffers. + 2012-03-21 Chong Yidong * faces.el (make-face, make-empty-face, copy-face): diff --git a/lisp/window.el b/lisp/window.el index f79041e0e6c..894d113cdc7 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -2600,11 +2600,14 @@ shall not be switched to in future invocations of this command." (not (setq killed-buffers (cons new-buffer killed-buffers)))) (not (eq new-buffer old-buffer)) - (or bury-or-kill + (or bury-or-kill (not (memq new-buffer next-buffers)))) - (set-window-buffer-start-and-point - window new-buffer (nth 1 entry) (nth 2 entry)) - (throw 'found t))) + (if (get-buffer-window new-buffer) + ;; Try to avoid showing a buffer visible in some other window. + (setq visible new-buffer) + (set-window-buffer-start-and-point + window new-buffer (nth 1 entry) (nth 2 entry)) + (throw 'found t)))) ;; Scan reverted buffer list of WINDOW's frame next, skipping ;; entries of next buffers. Note that when we bury or kill a ;; buffer we don't reverse the global buffer list to avoid showing